<template>
  <div
       class="app-container"
       v-loading="listLoading"
       element-loading-text="加载中"
       element-loading-spinner="el-icon-loading"
  >
    <div class="items" v-if="list.length">
      <echarts  v-for="(item,index) in list" :key="index" class="echart-item" :option="item.option" ref="chartDom"></echarts>
    </div>
  </div>
</template>
<script>
import { mapGetters } from 'vuex'
import api from '@/api/statistics'
import Echarts from '@/components/echart/Echarts.vue'

export default {
  name: 'Dashboard',
  components: {
    Echarts
  },
  data() {
    return {
      listLoading: true,
      list: []
    }
  },
  created() {
    this.get_data()
  },

  methods: {
    get_data() {
      api.getList().then(res => {
        if (res.code === 0) {
          this.list = res.data
        }
      }).finally(()=>{
        this.listLoading = false
      })
    }
  }
}
</script>

<style scoped>


.app-container {
  padding: 20px;
}

.echart-item {
  height: 250px;
}

</style>

